package com.graduation.sports.base;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

/**
 * @ProjectName: botanyEncyclopedia
 * @Package: com.graduation.botanyencyclopedia.base.ui
 * @ClassName: BaseRecycleViewAdapter
 * @Description: java类作用描述
 * @Author: APC
 * @CreateDate: 2021/2/5 15:18
 * @Version: 1.0
 */
public abstract class BaseRecycleViewAdapter extends RecyclerView.Adapter {
    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return getViewHolder(
                parent,
                viewType,
                LayoutInflater.from(parent.getContext()).inflate(
                        getLayout(viewType),
                        parent,
                        false
                )
        );
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {

    }

    @Override
    public int getItemCount() {
        return 0;
    }

    protected abstract int getLayout(int viewType);

    protected abstract RecyclerView.ViewHolder getViewHolder(ViewGroup parent, int viewType, View view);
}
